package OfferCode;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author Kechelle
 * @Date 2020/9/11 13:53
 * @Version 1.0
 */
public class Code61 {
    public static boolean isStraight(int[] nums) {
        int max = 0,min = 14;
        Set<Integer> set = new HashSet<>();
        for (int num:nums){
            if (num == 0) continue;
            if (set.contains(num)){
                return false;
            }
            set.add(num);
            max = Math.max(max,num);
            min = Math.min(min,num);
        }
        return (max-min)<5 ? true:false;
    }

    public static void main(String[] args) {
        int[] nums = {0,0,1,2,5};
        System.out.println(Code61.isStraight(nums));
    }
}
